package com.wawei.seeds.services;

import android.os.Bundle;
import android.os.Handler;

import com.wawei.seeds.model.HeroInfo;
import com.wawei.seeds.utils.RetrofitNetworkService;

import java.util.ArrayList;
import java.util.List;

import retrofit.RestAdapter;

/**
 *
 * Created by t27891 on 15/7/2.
 */
public class WalnutPortraitServiceHandler implements ServiceHandler {
    public static final String PORTRAIT_WHO = "who";
    public static final int PORTRAIT_SELF = 0;
    public static final int PORTRAIT_HERO = 1;

    @Override
    public void retrieveData(RestAdapter restAdapter, Bundle bundle, Handler handler, Integer handlerTag) {
        int whoisit = bundle.getInt(PORTRAIT_WHO);
        List<HeroInfo> heros = null;
        if(whoisit == PORTRAIT_SELF) {
            heros = new ArrayList<>(0);
            HeroInfo heroInfo = new HeroInfo();
            heroInfo.alias = "屌丝王";
            heroInfo.gender = "男";
            heroInfo.headPortrait = "http://ts3.mm.bing.net/th?id=JN.qQQfYzI5obhaHNUyo2ZlXQ&w=154&h=182&c=7&rs=1&qlt=90&o=4&pid=1.1";
            heros.add(heroInfo);
        }
        else if(whoisit == PORTRAIT_HERO){
            heros = new ArrayList<>(0);
            HeroInfo heroInfo = new HeroInfo();
            heroInfo.alias = "屌丝王";
            heroInfo.gender = "女";
            heroInfo.title = "UI设计师";
            heroInfo.magics = "平面设计、3D设计";
            heroInfo.webchat = "xxxxx";
            heroInfo.qq = "1234567";
            heroInfo.headPortrait = "http://ts3.mm.bing.net/th?id=JN.qQQfYzI5obhaHNUyo2ZlXQ&w=154&h=182&c=7&rs=1&qlt=90&o=4&pid=1.1";
            heros.add(heroInfo);
        }
        if (null != heros) {
            RetrofitNetworkService.handleSuccess(handler, handlerTag, heros.toArray());
        }
    }

    public void register(RestAdapter restAdapter, HeroInfo heroInfo, Handler handler, Integer handlerTag){

    }
}
